#!/bin/bash
yum install -y  perl-ExtUtils-MakeMaker
cd src
tar zxvf net-snmp-5.7.3.tar.gz
cd net-snmp-5.7.3
./configure --prefix=/usr/local/snmpd --enable-mfd-rewrite --with-default-snmp-version="2" --with-sys-contact="root@localhost" --with-sys-location="china" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"
make
make install
cd ..
cd ..
echo "export PATH=/usr/local/snmpd/bin:$PATH" >> /etc/profile
source /etc/profile
cp conf/snmpd.conf /usr/local/snmpd/
echo "/usr/local/snmpd/sbin/snmpd -c /usr/local/snmpd/snmpd.conf" >> /etc/rc.local
/usr/local/snmpd/sbin/snmpd -c /usr/local/snmpd/snmpd.conf 

echo "net-snmp installed"
echo "test:"
echo "snmpwalk -c 2c -c wknwkn 127.0.0.1"

